<template>
  <div class="father">
    <h3>父组件</h3>
    <div class="content">
      <Category title="热门游戏列表">
        <!-- 给插槽传递html 页面解构 -->
        <ul>
          <li
            v-for="g in games"
            :key="g.id"
          >{{ g.name }}</li>
        </ul>
      </Category>
      <Category title="今日美食城市">
        <img
          :src="imgUrl"
          alt=""
        >
      </Category>
      <Category title="今日合同审查推荐">
        <video
          :src="videoUrl"
          controls
        ></video>
      </Category>
    </div>
  </div>
</template>


<!-- 
在父组件里面 传递一些html 片段,子组件通过插槽来接收  

组件要如何接收模板内容呢？在某些场景中，我们可能想要为子组件传递一些模板片段，让子组件在它们的组件中渲染这些片段。
-->

<script setup lang="ts" name="Father">
import Category from './Category.vue'
import { ref, reactive } from "vue";

let games = reactive([
  { id: 'asgytdfats01', name: '英雄联盟' },
  { id: 'asgytdfats02', name: '王者农药' },
  { id: 'asgytdfats03', name: '红色警戒' },
  { id: 'asgytdfats04', name: '斗罗大陆' }
])

let imgUrl = ref('https://zhiexa-static-bucket.oss-cn-shanghai.aliyuncs.com/customized-mini/bind/hot-city.png')
let videoUrl = ref('https://static.zhiexa.com/customized-mini/v1.0.0/contract_ani/contract_ani.mp4')

</script>

<style scoped>
.father {
  background-color: rgb(165, 164, 164);
  padding: 20px;
  border-radius: 10px;
}

.content {
  display: flex;
  justify-content: space-evenly;
}

img,
video {
  width: 100%;
}
</style>